home *** CD-ROM | disk | FTP | other *** search
/ Family Forum 261 / SOMC Family Forum 261.iso / Xtras / Behavior Library.cst / 00014_Script_Message Sprite < prev    next >
Text File  |  1997-11-17  |  3KB  |  62 lines

  1. -- Message    Send to Sprite
  2.  
  3. -- behavior library version 1.1
  4.  
  5. -- Messaging
  6. -- sends an event to a specified sprite on author selected event
  7. -- the the addressee does not handle the event, it goes to the cast member script
  8. -- then the frame script, then the movie script
  9.  
  10. -- EventToSend must be a symbol 
  11. -- whichEvent inits the action
  12. -- Addressee is the sprite (channel number) the event is going to
  13.  
  14. -- also functions through lingo by handling message 'initSendSprite', 
  15. -- for example if this behavior was assigned to sprite 5, use
  16. -- sendsprite 5, #initSendSprite
  17.  
  18. property whichEvent, addressee, eventToSend, params
  19.  
  20. on initSendSprite me
  21.   init me
  22. end
  23.  
  24. on mouseUp me
  25.   if whichEvent = #mouseup  then init me
  26. end
  27.  
  28. on mouseDown me
  29.   if whichEvent = #mousedown  then init me
  30. end
  31.  
  32. on prepareFrame me
  33.   if whichEvent = #prepareframe then init me
  34. end
  35.  
  36. on enterFrame me
  37.   if whichEvent = #enterframe  then init me
  38. end
  39.  
  40. on exitFrame me
  41.   if whichEvent = #exitframe  then init me
  42. end
  43.  
  44. on init me
  45.   set doit = "sendSprite the Addressee of me, the EventToSend of me," && params
  46.   do doit
  47. end
  48.  
  49. ---
  50.  
  51. on getPropertyDescriptionList  
  52.   
  53.   set p_list = [    #EventToSend: [ #comment:   "Message:",                     #format:   #symbol,                    #default:   #generic_event ],    #Params:      [ #comment:   "Param1, param2, ...",                     #format:   #string,                    #default:   "" ],   #Addressee: [ #comment:   "Target Sprite:",                     #format:   #integer,                    #default:    1 ],     #WhichEvent: [ #comment:   "Initializing Event:",                     #format:   #symbol,                      #range: [ #MouseUp, #MouseDown, #PrepareFrame, #EnterFrame, #ExitFrame, #InitSendSprite],                    #default:   #MouseUp ]                  ]
  54.   return p_list  
  55.   
  56. end
  57.  
  58. on getBehaviorDescription
  59.   return "Sends a message to the designated sprite when the specified event occurs.  Any behaviors attached to the target sprite that are triggered by the message will be executed." & RETURN & "PARAMETERS:" & RETURN & "ò Message - Enter the message to send to the target sprite."  & RETURN & "ò Params  - Enter parameters to be sent with the message, seperated with commas."  & RETURN & "ò Target Sprite - Enter the number of the sprite channel to which message should be sent."  & RETURN & "ò Initializing Event - Specify the event that triggers the behavior." & RETURN & "NOTES:" & RETURN & "If there is no behavior attached to the target sprite that responds to the message being sent, the message is passed to the cast member script, the current frame script, and then movie scripts." 
  60.   
  61.   
  62. end